<?php

namespace app\configure\controller;

use app\configure\model\ConfigPatrolItemModel;
use think\admin\Controller;

class ConfigPatrolItem extends Controller
{
    /**
     * 当前操作数据库
     * @var string
     */
    private string $table = 'ConfigQuestion';

    /**
     * 巡查设备检查项
     * @auth true
     * @menu true
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function index()
    {
        $this->title = '巡查设备检查项';
//        $this->type =$this->request->param('type', 'index');
        $this->_query(ConfigPatrolItemModel::class)->like('name')->equal('type')->order('id desc')->page(true, true);
    }

    /**
     * 添加
     * @auth true
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function add()
    {
        $id = $this->request->get('qid');
        $this->assign('qid', $id);
        $this->_form(ConfigPatrolItemModel::class, 'form');
    }

    /**
     * 修改
     * @auth true
     * @throws ModelNotFoundException
     * @throws DataNotFoundException
     * @throws DbException
     */
    public function edit()
    {
        $id = $this->request->get('qid');
        $this->assign('qid', $id);
        $this->_applyFormToken();
        $this->_form(ConfigPatrolItemModel::class, 'form');
    }


    public function del()
    {
    }

    /**
     * 删除
     * @auth true
     * @throws DbException
     */
    public function removeItem()
    {
        $this->_delete(ConfigPatrolItemModel::class);
    }
}